package com.yipei.business.controller;

import com.yipei.business.domain.MlBtsPoint;
import com.yipei.business.service.IMlBtsPointService;
import com.yipei.common.annotation.Log;
import com.yipei.common.core.controller.BaseController;
import com.yipei.common.core.domain.AjaxResult;
import com.yipei.common.core.page.TableDataInfo;
import com.yipei.common.enums.BusinessType;
import com.yipei.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 标识BTSController
 *
 * @author yipei
 * @date 2024-12-23
 */
@RestController
@RequestMapping("/business/bspoint")
@Api(tags = "标识BTS", description = "标识BTS管理")
public class MlBtsPointController extends BaseController {
    @Autowired
    private IMlBtsPointService mlBtsPointService;

    /**
     * 查询标识BTS列表
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:list')")
    @ApiOperation("标识BTS获取数据")
    @GetMapping("/list")
    public TableDataInfo list(MlBtsPoint mlBtsPoint) {
        startPage();
        List<MlBtsPoint> list = mlBtsPointService.selectMlBtsPointList(mlBtsPoint);
        return getDataTable(list);
    }

    /**
     * 导出标识BTS列表
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:export')")
    @ApiOperation("标识BTS导出数据")
    @Log(title = "标识BTS", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MlBtsPoint mlBtsPoint) {
        List<MlBtsPoint> list = mlBtsPointService.selectMlBtsPointList(mlBtsPoint);
        ExcelUtil<MlBtsPoint> util = new ExcelUtil<MlBtsPoint>(MlBtsPoint.class);
        util.exportExcel(response, list, "标识BTS数据");
    }

    /**
     * 获取标识BTS详细信息
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:query')")
    @ApiOperation("标识BTS通过ID获取数据")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(mlBtsPointService.selectMlBtsPointById(id));
    }

    /**
     * 新增标识BTS
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:add')")
    @ApiOperation("标识BTS新增数据")
    @Log(title = "标识BTS", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MlBtsPoint mlBtsPoint) {
        return toAjax(mlBtsPointService.insertMlBtsPoint(mlBtsPoint));
    }

    /**
     * 修改标识BTS
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:edit')")
    @ApiOperation("标识BTS修改数据")
    @Log(title = "标识BTS", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MlBtsPoint mlBtsPoint) {
        return toAjax(mlBtsPointService.updateMlBtsPoint(mlBtsPoint));
    }

    /**
     * 删除标识BTS
     */
    //@PreAuthorize("@ss.hasPermi('business:bspoint:remove')")
    @ApiOperation("标识BTS删除数据")
    @Log(title = "标识BTS", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(mlBtsPointService.deleteMlBtsPointByIds(ids));
    }
}
